<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>编辑信息模板</title>
	<#include "/common/resource.ftl">
	<script type="text/javascript" charset="utf-8" src="${params.contextPath}/common/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="${params.contextPath}/common/ueditor/ueditor.all.js"></script>
	<script type="text/javascript" charset="utf-8" src="${params.contextPath}/common/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
    var ue;
        $(function () {
        <#if (params.id)??> 
            $.ajaxRequest({   //回显数据
                url: '${params.contextPath}/web/informationTemplate/query.json',
                data: {id: "${params.id}"},
                success: function (data) {
                    if (!data.success) {
                        $.message(data.message);
                        return;
                    }
                    var record = data.data;
                    for (var key in record) {
                        $("[name='" + key + "']").val(record[key]);
                        if(key=='content'){ //模板正文内容回显
                        	ue.ready(function(){ 
                            	ue.setContent(record['content']);
                            });
                        }
                    }
                }
            });
        </#if>
        });
    </script>
</head>
<body>
<div class="ui-form" style="padding: 20px;padding-top: 10px;">
    <form class="layui-form my-form ajax-form" action="${params.contextPath}/web/informationTemplate/<#if (params.id)??>modify<#else>save</#if>.json" method="post">
        <input type="hidden" name="id" value="${params.id}"/>
        <input type="hidden" name="inputListStr"/>
        
        <div class="layui-form-item" style="clear: none;width: 50%;float: left">
            <label class="layui-form-label">模板名称<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" placeholder="请输入模板名称,可输入50个字符" name="name" maxlength="50">
            </div>
        </div>
        
        <div class="layui-form-item" style="clear: none;width: 50%;float: left">
            <label class="layui-form-label">排序号<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" placeholder="请输入显示序号" name="orderNum" maxlength="50">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">说明</label>
            <div class="layui-input-block">
                <input class="layui-input" name="remark" placeholder="说明，可输入200个字符" maxlength="200" />
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label">信息模板正文<span class="ui-request">*</span></label>
            <div class="layui-input-block">
                <script type="text/plain" id="myEditor" name="content" style="width:632px;height:300px;"></script>
            </div>
        </div>
        
        <div class="layui-form-item" style="padding-top: 10px;text-align: center;">
            
                <input type="submit" value="保 存" class="layui-btn"/>
            
        </div>
    </form>
</div>
<script>


$(function(){   //模板正文内容回显操作
	ue = ue||UE.getEditor('myEditor');
});
</script>
</body>
</html>
